package cn.iune.erp.payment;

import java.math.BigDecimal;
import java.sql.Date;
import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;

import com.justep.baas.data.RowState;

//收付款从表（核销表）

@Entity
@Table(name = "AccountPaymentDetail")
@NamedQuery(name="AccountPaymentDetail.findAll", query="SELECT s FROM AccountPaymentDetail s")
public class AccountPaymentDetail {

	
	@Id
	@Column(length=36)
	private String fID;
	
	@Column(length=32)
	private String systemCode;
	
	/*
	
	//核销类型
	6.到款核销
	7.应收冲应付
	8.预收冲预付
	9.应收款转销
	A.预收款转销
	D.退款核销
	
	6.付款核销
	7.应收冲应付
	8.预收冲预付
	9.应付款转销
	A.预付款转销
	D.退款核销
	
	*/
	
	@Column(length=4)
	private String clearType;
	@Column(length=20)
	private String clearTypeLabel;
	
	/*
	//款项类别
	1.销售发票
	2.其他应收
	3.收款单
	4.冲减预收款
	Y.冲减会员余额

	
	1.采购发票
	2.其他应付
	3.付款单
	4.冲减预付款
	*/

	@Column(length=4)
	private String billType;
	@Column(length=20)
	private String billTypeName;
	
	
	private Date orderDate;
	@Column(length=10)
	private String state = "active";
	@Column(length=10)
	private String status = "open";
	@Column(length=10)
	private String audit = "active";

//	private int flowType = 0;
	@Column(length=1)
	private String revOpay;
	private int direction = 0;
	private Date confirmDate;
	
	@Column(length=4)
	private String origin;
	@Column(length=20)
	private String originName;
	@Column(length=20)
	private String originNo;
	
	//收款单号/核销批号/线下门店流水号
	@Column(length=20)
	private String accountPaymentNo;
	
	@Column(length=3)
	private String currency;//币种
	@Column(length=20)
	private String currencyLabel;//币种
	@Column(precision=38,scale=6)
	private BigDecimal exchangeRate = BigDecimal.ZERO;//汇率

	@Column(length=32)
	private String settleCode;
	private Date settleDate;//收款日期
//	private Date expiringDate;//应收账款到期日
	
	//收款日期/到期日期等等
	
	@Column(length=3)
	private String dealObject;
	@Column(length=20)
	private String dealObjectLabel;
	@Column(length=32)
	private String customerID;
	@Column(length=15)
	private String customerNo;
	@Column(length=20)
	private String shortName;
	@Column(length=128)
	private String customerName;
	
//	@Column(length=128)
//	private String accountBank;
//	@Column(length=20)
//	private String accountNo;
	
	@Column(length=32)
	private String captionID;//科目编码
	@Column(length=10)
	private String captionNo;
	@Column(length=50)
	private String captionName;
	@Column(length=256)
	private String captionFullName;//科目名称
	
	@Column(precision=38,scale=2)
	private BigDecimal orderAmount;       //实收表-主：实际金额    //从表：应收票据金额
	@Column(precision=38,scale=2,columnDefinition="DECIMAL(38,2) default 0",nullable=false)
	private BigDecimal discountCash;	    //实收表-主：现金折扣	  //从表：现金折扣
	@Column(precision=38,scale=2)
	private BigDecimal orderAmountTotal;  //实收表：单据金额  //从表：不使用
	
	@Column(precision=38,scale=2)
	private BigDecimal orderAmountCleared; //实收表：核销金额  //从表：核销金额
	@Column(precision=38,scale=2,columnDefinition="DECIMAL(38,2) default 0",nullable=false)
	private BigDecimal pendingAmount;	  //实收表-主：未核销金额  //从表：应收票据余额
	
	@Column(length=32)
	private String fMasterID;
	
	@Column(precision=38,scale=2)
	private BigDecimal accountClearPayable;//应收表：账应收/应收核销金额//实收表：0    	
	@Column(precision=38,scale=2)
	private BigDecimal accountClearActual; //应收表：0//实收表：账实收/实收核销金额
	@Column(precision=38,scale=2)
	private BigDecimal accountDiscountCash;//应收表：账应收/核销折扣金额//实收表：0  

	
	//收付款摘要
//	@Column(length=256)
//	private String remark;//使用描述//优惠券title
	
	@Column(columnDefinition="INT default 0",nullable=false)
	private int retailFlag = 0;//批发还是零售（0：批发，1：零售）
	
	//现结
	@Column(columnDefinition="INT default 0 COMMENT '现结'",nullable=false)
	private int cashSettle = 0;//由销货单自动生成付款单，在收款单录入界面无法删除，只能由销货单撤销审批时删除
	
	@Column(columnDefinition="INT default 0 COMMENT '生成分录'",nullable=false)
	private int entryFlag = 0;//生成分录
	
	@Column(length=1)
	private String settleCategory;//结算方式
	@Column(length=20)
	private String settleCategoryLabel;
	
//	@Column(length=32)
//	private String capitalID;//资金账户编码（只是现结时才使用，其他时候都是空的）
//	@Column(length=10)
//	private String capitalNo;
//	@Column(length=50)
//	private String capitalName;
//	@Column(length=256)
//	private String capitalFullName;//资金账户名称

	@Column(length=15)
	private String orderNo;
	@Column(length=15)
	private String projectNo;
	
	//门店流水号（客人流水号）
	@Column(length=20)
	private String guestNumber;

//	@Column(length=20)
//	private String resultStatus = "待审核";
	
//	@Column(length=10)
//	private String handling = "unclear";//"unclear"：未核销，"clearing"：部分核销，"cleared"：已核销，"finished"：已完成，"cancelled"：已取消
//	@Column(length=10)
//	private String handlingLabel = "未核销";

//	private int maxDetailNo = 0;

//	@Column(length=65)
//	private String departmentNo;
//	@Column(length=256)
//	private String departmentName;
	@Column(length=256)
	private String employeeNo;
	@Column(length=256)
	private String employeeName;

	@Column(length=255)
	private String comments;
	
	@Column(length=15)
	private String cUsercode;
	@Column(length=20)
	private String cUsername;//制单人
	private Timestamp cDatetime;
	@Column(length=15)
	private String tUsercode;
	@Column(length=20)
	private String tUsername;//审核人
	private Timestamp tDatetime;
	@Column(length=15)
	private String eUsercode;
	@Column(length=20)
	private String eUsername;//关单人
	private Timestamp eDatetime;
	
	@Column(length=65)
	private String userId;

	@Column(length=128)
	private String enterpriseNo;
	@Column(length=128)
	private String enterpriseName;


	@Version
	private int version = 0;
	
	@Transient//非持久字段
	private RowState rowState;
	public RowState getRowState() {
		return rowState;
	}
	public void setRowState(RowState rowState) {
		this.rowState = rowState;
	}
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}
	
	public String getOriginName() {
		return originName;
	}

	public String getDealObjectLabel() {
		return dealObjectLabel;
	}

	public void setDealObjectLabel(String dealObjectLabel) {
		this.dealObjectLabel = dealObjectLabel;
	}

	public String getcUsercode() {
		return cUsercode;
	}

	public void setcUsercode(String cUsercode) {
		this.cUsercode = cUsercode;
	}

	public String getcUsername() {
		return cUsername;
	}

	public void setcUsername(String cUsername) {
		this.cUsername = cUsername;
	}

	public Timestamp getcDatetime() {
		return cDatetime;
	}

	public void setcDatetime(Timestamp cDatetime) {
		this.cDatetime = cDatetime;
	}

	public String gettUsercode() {
		return tUsercode;
	}

	public void settUsercode(String tUsercode) {
		this.tUsercode = tUsercode;
	}

	public String gettUsername() {
		return tUsername;
	}

	public void settUsername(String tUsername) {
		this.tUsername = tUsername;
	}

	public Timestamp gettDatetime() {
		return tDatetime;
	}

	public void settDatetime(Timestamp tDatetime) {
		this.tDatetime = tDatetime;
	}

	public String geteUsercode() {
		return eUsercode;
	}

	public void seteUsercode(String eUsercode) {
		this.eUsercode = eUsercode;
	}

	public String geteUsername() {
		return eUsername;
	}

	public void seteUsername(String eUsername) {
		this.eUsername = eUsername;
	}

	public Timestamp geteDatetime() {
		return eDatetime;
	}

	public void seteDatetime(Timestamp eDatetime) {
		this.eDatetime = eDatetime;
	}

	public void setOriginName(String originName) {
		this.originName = originName;
	}


	public String getBillTypeName() {
		return billTypeName;
	}

	public void setBillTypeName(String billTypeName) {
		this.billTypeName = billTypeName;
	}


	public String getSystemCode() {
		return systemCode;
	}

	public void setSystemCode(String systemCode) {
		this.systemCode = systemCode;
	}

	public String getAudit() {
		return audit;
	}

	public void setAudit(String audit) {
		this.audit = audit;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getProjectNo() {
		return projectNo;
	}

	public void setProjectNo(String projectNo) {
		this.projectNo = projectNo;
	}


	public Date getConfirmDate() {
		return confirmDate;
	}

	public void setConfirmDate(Date confirmDate) {
		this.confirmDate = confirmDate;
	}

	public String getRevOpay() {
		return revOpay;
	}

	public void setRevOpay(String revOpay) {
		this.revOpay = revOpay;
	}

	public String getfID() {
		return fID;
	}
	public void setfID(String fID) {
		this.fID = fID;
	}
	public String getAccountPaymentNo() {
		return accountPaymentNo;
	}
	public void setAccountPaymentNo(String accountPaymentNo) {
		this.accountPaymentNo = accountPaymentNo;
	}
	public String getCustomerNo() {
		return customerNo;
	}
	public void setCustomerNo(String customerNo) {
		this.customerNo = customerNo;
	}
	public String getCustomerName() {
		return customerName;
	}
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	public BigDecimal getOrderAmount() {
		return orderAmount;
	}
	public void setOrderAmount(BigDecimal orderAmount) {
		this.orderAmount = orderAmount;
	}

	public int getDirection() {
		return direction;
	}

	public void setDirection(int direction) {
		this.direction = direction;
	}

	public BigDecimal getOrderAmountTotal() {
		return orderAmountTotal;
	}
	public void setOrderAmountTotal(BigDecimal orderAmountTotal) {
		this.orderAmountTotal = orderAmountTotal;
	}

	public String getOrigin() {
		return origin;
	}
	public void setOrigin(String origin) {
		this.origin = origin;
	}
	public String getEnterpriseNo() {
		return enterpriseNo;
	}
	public void setEnterpriseNo(String enterpriseNo) {
		this.enterpriseNo = enterpriseNo;
	}
	public String getEnterpriseName() {
		return enterpriseName;
	}
	public void setEnterpriseName(String enterpriseName) {
		this.enterpriseName = enterpriseName;
	}

	public String getDealObject() {
		return dealObject;
	}
	public void setDealObject(String dealObject) {
		this.dealObject = dealObject;
	}
	public String getShortName() {
		return shortName;
	}
	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	public Date getOrderDate() {
		return orderDate;
	}
	public void setOrderDate(Date orderDate) {
		this.orderDate = orderDate;
	}
	public String getEmployeeNo() {
		return employeeNo;
	}
	public void setEmployeeNo(String employeeNo) {
		this.employeeNo = employeeNo;
	}
	public String getEmployeeName() {
		return employeeName;
	}
	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}

	public String getBillType() {
		return billType;
	}

	public void setBillType(String billType) {
		this.billType = billType;
	}

	public String getOriginNo() {
		return originNo;
	}

	public void setOriginNo(String originNo) {
		this.originNo = originNo;
	}
	public String getCustomerID() {
		return customerID;
	}
	public void setCustomerID(String customerID) {
		this.customerID = customerID;
	}
	public String getCaptionID() {
		return captionID;
	}
	public void setCaptionID(String captionID) {
		this.captionID = captionID;
	}
	public String getCaptionNo() {
		return captionNo;
	}
	public void setCaptionNo(String captionNo) {
		this.captionNo = captionNo;
	}
	public String getCaptionName() {
		return captionName;
	}
	public void setCaptionName(String captionName) {
		this.captionName = captionName;
	}
	public String getCaptionFullName() {
		return captionFullName;
	}
	public void setCaptionFullName(String captionFullName) {
		this.captionFullName = captionFullName;
	}

	public BigDecimal getDiscountCash() {
		return discountCash;
	}
	public void setDiscountCash(BigDecimal discountCash) {
		this.discountCash = discountCash;
	}
	public BigDecimal getPendingAmount() {
		return pendingAmount;
	}
	public void setPendingAmount(BigDecimal pendingAmount) {
		this.pendingAmount = pendingAmount;
	}
	public int getCashSettle() {
		return cashSettle;
	}
	public void setCashSettle(int cashSettle) {
		this.cashSettle = cashSettle;
	}
	public String getSettleCategory() {
		return settleCategory;
	}
	public void setSettleCategory(String settleCategory) {
		this.settleCategory = settleCategory;
	}
	public String getSettleCategoryLabel() {
		return settleCategoryLabel;
	}
	public void setSettleCategoryLabel(String settleCategoryLabel) {
		this.settleCategoryLabel = settleCategoryLabel;
	}
	public String getOrderNo() {
		return orderNo;
	}
	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}
	public String getSettleCode() {
		return settleCode;
	}
	public void setSettleCode(String settleCode) {
		this.settleCode = settleCode;
	}
	public BigDecimal getOrderAmountCleared() {
		return orderAmountCleared;
	}
	public void setOrderAmountCleared(BigDecimal orderAmountCleared) {
		this.orderAmountCleared = orderAmountCleared;
	}

	public BigDecimal getAccountClearPayable() {
		return accountClearPayable;
	}
	public void setAccountClearPayable(BigDecimal accountClearPayable) {
		this.accountClearPayable = accountClearPayable;
	}
	public BigDecimal getAccountClearActual() {
		return accountClearActual;
	}
	public void setAccountClearActual(BigDecimal accountClearActual) {
		this.accountClearActual = accountClearActual;
	}
	public BigDecimal getAccountDiscountCash() {
		return accountDiscountCash;
	}
	public void setAccountDiscountCash(BigDecimal accountDiscountCash) {
		this.accountDiscountCash = accountDiscountCash;
	}
	public String getClearType() {
		return clearType;
	}
	public void setClearType(String clearType) {
		this.clearType = clearType;
	}
	public String getClearTypeLabel() {
		return clearTypeLabel;
	}
	public void setClearTypeLabel(String clearTypeLabel) {
		this.clearTypeLabel = clearTypeLabel;
	}
	public String getfMasterID() {
		return fMasterID;
	}
	public void setfMasterID(String fMasterID) {
		this.fMasterID = fMasterID;
	}
	public String getCurrency() {
		return currency;
	}
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	public String getCurrencyLabel() {
		return currencyLabel;
	}
	public void setCurrencyLabel(String currencyLabel) {
		this.currencyLabel = currencyLabel;
	}
	public BigDecimal getExchangeRate() {
		return exchangeRate;
	}
	public void setExchangeRate(BigDecimal exchangeRate) {
		this.exchangeRate = exchangeRate;
	}
	public String getGuestNumber() {
		return guestNumber;
	}
	public void setGuestNumber(String guestNumber) {
		this.guestNumber = guestNumber;
	}
	public int getRetailFlag() {
		return retailFlag;
	}
	public void setRetailFlag(int retailFlag) {
		this.retailFlag = retailFlag;
	}
	public int getEntryFlag() {
		return entryFlag;
	}
	public void setEntryFlag(int entryFlag) {
		this.entryFlag = entryFlag;
	}
	public Date getSettleDate() {
		return settleDate;
	}
	public void setSettleDate(Date settleDate) {
		this.settleDate = settleDate;
	}

	

}
